package phoenix.web.test_objects;

import phoenix.core.PhoenixManager;
import phoenix.core.base.extensions.TestBaseWebExt;

/**
 * Class contains test methods for WelcomePage
 */
public class WelcomePopupTests extends TestBaseWebExt
{

	public WelcomePopupTests(PhoenixManager p_phoenix)
	{
		super(p_phoenix);
	}

	/**
	 * Re send email at welcome pop up test
	 */
	public void resendEmailTest()
	{
		try
		{
			if (manager.isLGW() || manager.isNF())
			{
				page().welcomePage().clickOpenResend();
			}

			page().welcomePage().clickResendEmail();
			page().welcomePage().waitForResendNotification();
			wd().wait(60);
		}
		catch (Exception p_ex)
		{
			log().errorAndScreen("resendEmailTest: " + p_ex.toString());
		}

		test().forErrors();
	}

	public void changeEmailTest(String p_newEmail)
	{
		try
		{
			if (manager.isLGW() || manager.isNF())
			{
				page().welcomePage().clickOpenResend();
			}
			else
			{
				page().welcomePage().clickChangeEmail();
			}
			page().welcomePage().setChangeEmail(p_newEmail);
			page().welcomePage().submitChangeEmail();
		}
		catch (Exception p_ex)
		{
			log().errorAndScreen("changeEmailTest: " + p_ex.toString());
		}

		test().forErrors();
	}
}
